package com.weiyu.bultrasound.core.model.common;

import org.springframework.util.StringUtils;

/**
 *@description 
 *@author abner chow
 *@date 2019-08-09 14:08
 */
public enum IdCategoryEnum {

    IDENTITY_CARD("01", "居民身份证"),
    HOUSEHOLD_REGISTER("02", "居民户口簿"),
    PASSPORT("03", "护照"),
    MILITARY_ID("04", "军官证"),
    DRIVER_LICENSE("05", "驾驶证"),
    HONG_KONG_MACAO_PASSPORT("06", "港澳居民来往内地通行证"),
    TAI_WANG_PASSPORT("07", "台湾居民来往内地通行证"),
    SOLDIERS_ID("08", "士兵证"),
    OTHER("99", "其他法定有效证件"),
    ;

    protected String code;
    protected String desc;

    private IdCategoryEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getByCode(String code) {
        String  desc = "";
        if (StringUtils.hasText(code)) {
            for (IdCategoryEnum idCategoryEnum : IdCategoryEnum.values()) {
                if (idCategoryEnum.getCode().equals(code)) {
                    desc = idCategoryEnum.getDesc();
                }
            }
        }
        return desc;
    }

}
